package com.litbw.publicobservable;

import com.litbw.gui.MainGUI;

/**
 * The BasicUIMessage is usefull for signaling the UI to do some sort of action
 * such as showing the current users profile.
 * @author Michael Morris
 *
 */
public class BasicUIMessage extends SimpleMessage {
	
	/**
	 * 
	 * Add messages here where needed everyone! Not sure if we'll need all the
	 * ones i put in, but it's a good start.
	 * 
	 * The UISignal enum simply allows one message to send "signals", without
	 * any accompanying data, to the UI.
	 * 
	 * @author Michael Morris
	 *
	 */
	public static enum UISignal {
		SHOW_EVENTS,
		SHOW_REGISTER,
		SHOW_REGISTER_EVENT,
		SHOW_CONTEST,
		SHOW_EVENT_DETAIL,
		ENABLE_CONTESTS,
		ENABLE_PROFILE, 
		SHOW_USER_PROFILE;
	}
	
	/**
	 * The signal stored by this BasicUIMessage.
	 */
	private final UISignal my_signal;
	
	/**
	 * Create a new BasicUIMessage.
	 * @param signal The UISignal to send with this message.
	 */
	public BasicUIMessage(final UISignal signal) {
		if (signal == null)
			throw new IllegalArgumentException("signal cannot be null");
		
		my_signal = signal;
		
		// Set the recipient to be ONLY the UI. We can change this to whatever
		// the main GUI class is.
		setRecipientClass(MainGUI.class);
		
	}
	
	/**
	 * Retrieve the signal stored in this BasicUIMessage.
	 * @return A UISignal enumeration.
	 */
	public final UISignal getSignal() {
		return my_signal;
	}
	
}
